/**
 * 文件名：WeekDaysEnum.java
 * 公司名：深圳弘金信息科技有限公司
 * 版权所有：Copyright © 2015 Shenzhen Holborn Information Technologies Co..Ltd, Inc. All rights reserved.
 * 作者：Nail.zhang
 * 时间：2018年7月3日
 */
package com.talos.framework.common.util.date;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 
 * @author Nail.zhang
 *
 */

public enum WeekDaysEnum {
	sun(1, "周日"),Mon(2, "周一"), Tus(3, "周二"), Wen(4, "周三"), Thu(5, "周四"), Fri(6, "周五"), Sat(7, "周六");
 
    private int typeId;
    private String typeName;
 
    WeekDaysEnum(int typeId, String typeName) {
        this.typeId = typeId;
        this.typeName = typeName;
    }
 
    public int getTypeId() {
        return typeId;
    }
 
    public String getTypeName() {
        return typeName;
    }
 
    public static List toList() {
        List list = new ArrayList();
        Map item = new HashMap();
        WeekDaysEnum[] values = values();
        for (int i = 0; i < values.length; ++i) {
            //item = new HashMap();
            WeekDaysEnum value = values[i];
            item.put("typeId", Integer.valueOf(value.getTypeId()));
            item.put("typeName", value.getTypeName());
            list.add(item);
        }
        return list;
    }
 
    public static String getTypeNameById(int typeId) {
        String value = "未知" + typeId;
        WeekDaysEnum[] values = values();
 
        for(int i = 0; i < values.length; ++i) {
            WeekDaysEnum type = values[i];
            if(type.getTypeId() == typeId) {
                value = type.getTypeName();
                break;
            }
        }
 
        return value;
    }
 
}
